
#include <iostream>
#include <sol/sol.hpp>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/stdout_color_sinks.h"

int main() {
	auto console = spdlog::stdout_color_mt("console");

	sol::state lua;
	lua.open_libraries(sol::lib::base);
	auto result = lua.script_file("main.lua");
	if (!result.valid())
	{
		console->warn("load main.lua fail");
		return -1;
	}
	sol::function fx = lua["add"];
	std::function<int(int, int)> stdfx = fx;
	int r = stdfx(2, 4);
	console->info("return value: {}",r);
	return 0;
}
